package com.stef.MMH;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class EmfHolder {
	
	private static EntityManagerFactory emf;
	private static EntityManager em;
	private static EmfHolder instance;
	
	
	private EmfHolder(){
	emf = Persistence.createEntityManagerFactory("transactions-optional");
	em = emf.createEntityManager();
	}

	public static EntityManager getEntityManager(){
		if (instance == null){
			instance = new EmfHolder();
		}
		return em;
	}
}
